package com.gitpractice.liwushuo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;

import java.util.List;

/**
 * Created by Sherlock·SU on 2016/7/20.
 */
public class CategoryAdapter extends FragmentPagerAdapter {
    private static final String TAG = "FragmentPagerAdapter";
    private List<Fragment> mFragmentList;
    private String[] arr;

    public CategoryAdapter(FragmentManager fm, List<Fragment> mFragmentList,String[] arr) {
        super(fm);
        this.mFragmentList = mFragmentList;
        this.arr=arr;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return mFragmentList==null?0:mFragmentList.size();

    }
    @Override
    public CharSequence getPageTitle(int position) {
        Log.i(TAG, "getPageTitle: "+arr[position]);
        return arr[position];
    }
}
